#include"bits/stdc++.h"
using namespace std;
int p,x_0,y_0,x_1,y_1;
int main()
{
	cin>>p>>x_0>>y_0>>x_1>>y_1;
	if(p==1)
	{
		if(x_0==x_1||y_0==y_1)
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
	}
	else if(p==2)
	{
		cout<<"No";
	}
	else if(p==3)
	{
		if(x_0+2==x_1&&y_0+1==y_1||x_0+2==x_1&&y_0-1==y_1||x_0-2==x_1&&y_0+1==y_1||x_0-2==x_1&&y_0-1==y_1||x_0+1==x_1&&y_0+2==y_1||x_0+1==x_1&&y_0-2==y_1||x_0-1==x_1&&y_0+2==y_1||x_0-1==x_1&&y_0-2==y_1)
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
	}
	else
	{
		if(x_0+2==x_1&&y_0+2==y_1||x_0+2==x_1&&y_0-2==y_1||x_0-2==x_1&&y_0+2==y_1||x_0-2==x_1&&y_0-2==y_1)
		{
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
	}
}
